<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="site" value="list" scope="application"/>
<html>
<c:import url="module/jsp/head.jsp"/>
<body>
<c:import url="module/jsp/header.jsp"/>
<c:import url="module/jsp/aside.jsp"/>
<main>
    <div class="main-content">

        <div class="welcome">您现在的位置是：首页>文章</div>
        <div class="blogbox">
            <div class="bloglist">
                <ul>
                    <c:forEach items="${page.records}" var="chapter">
                        <li style="margin-bottom:20px;">
                            <h2><a target="_blank" href="${pageContext.request.contextPath}/info?id=${chapter.id}">${chapter.title}</a>
                            </h2>
                            <i>
                                <a target="_blank" href="${pageContext.request.contextPath}/info?id=${chapter.id}">
                                    <img src="${chapter.imgUrl}">
                                </a>
                            </i>
                            <p class="blogtext">${chapter.title}</p>
                            <p class="bloginfo">
                                <span>shanAdmin</span>
                                <span>
                                    <jsp:useBean id="timestamp" class="java.util.Date"/>
                                    <jsp:setProperty name="timestamp" property="time" value="${chapter.gmtCreate *1000}"/>
                                    <fmt:formatDate value="${timestamp}" pattern="yyyy-MM-dd"/>
                                </span>
                                <span>
                                    <c:forEach items="${chapter.categoryList}" var="category">
                                        <a href="${pageContext.request.contextPath}/list?categoryId=${category.id}">${category.name}</a>
                                    </c:forEach>
                                </span>
                            </p>
                            <br>
                            <p class="bloginfo">
                                <span style="display: none"></span>
                                <span style="display: none"></span>
                                <span>
                                    <c:forEach items="${chapter.labelList}" var="label">
                                        <a href="${pageContext.request.contextPath}/list?labelId=${label.id}">${label.name}</a>
                                    </c:forEach>
                                </span>
                            </p>
                        </li>
                    </c:forEach>
                </ul>
            </div>
            <div class="pagelist">
                <a title="Total record">&nbsp<b>总记录：${page.total}</b></a>&nbsp;&nbsp;

                <c:if test="${page.current gt 1}">
                    <a>首页</a>&nbsp;
                </c:if>

                <c:if test="${page.current gt 1}">
                    <a>上一页</a>
                </c:if>

                <c:if test="${page.current > 2} ">
                    <c:forEach var="x" begin="${page.current-2}" end="${page.current}">
                        <a href="${pageContext.request.contextPath}/list?page=${x}">${x}</a>
                    </c:forEach>
                </c:if>
                <b>${page.current}</b>
                <c:if test="${page.current < page.total/page.size - 2} ">
                    <c:forEach var="x" begin="${page.current}" end="${page.current + 2}">
                        <a href="${pageContext.request.contextPath}/list?page=${x}">${x}</a>
                    </c:forEach>
                </c:if>
                <c:if test="${page.total/page.size gt page.current}">
                    <a>下一页</a>&nbsp;
                </c:if>

                <c:if test="${page.current lt page.total/page.size}">
                    <a>尾页</a>
                </c:if>
            </div>
        </div>
        <div class="rside">
            <c:forEach items="${categorylist}" var="category">
            <div class="news">
                <h2 class="newstitle">
                  <span>
                    <a href="${pageContext.request.contextPath}/list?categoryId=${category.id}">更多</a>
                  </span>
                  <b>${category.name}</b>
                </h2>
                <ul>
                    <c:forEach items="${category.chapterList}" var="chapter">
                    <li>
                        <a href="${pageContext.request.contextPath}/info?id=${chapter.id}">
                            <span>
                                <jsp:useBean id="timestamp1" class="java.util.Date"/>
                                <jsp:setProperty name="timestamp1" property="time" value="${chapter.gmtCreate *1000}"/>
                                <fmt:formatDate value="${timestamp1}" pattern="yyyy-MM-dd"/>
                            </span>
                            ${chapter.title}
                        </a>
                    </li>
                    </c:forEach>
                </ul>
            </div>
            </c:forEach>
        </div>
        <c:import url="module/jsp/footer.jsp"/>
    </div>
</main>
<a href="#" class="cd-top cd-is-visible">Top</a>
</body>
<c:import url="module/jsp/js.jsp"/>
</html>
